<?php

namespace App\Events\OpenShop;

use App\Models\OpenShop\InvestmentPromotion\OpenShopSignOrderModel;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class JoinSucceededSmsSentEvent
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public OpenShopSignOrderModel $order;
    public string                 $datetime = '';
    // 飞书员工姓名
    public string                 $userName;

    public function __construct(?OpenShopSignOrderModel $orderModel, $userName)
    {
        $this->order    = $orderModel;
        $this->userName = $userName;
        $this->datetime = now()->toDateTimeString();
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return \Illuminate\Broadcasting\Channel|array
     */
    public function broadcastOn()
    {
        return new PrivateChannel('channel-name');
    }
}
